<template>
    <view id="guide">
		<u-swiper
			:list="guideList"
			@change="change"
			@click="click"
			:height='phoneHeight'
			:autoplay='false'
			imgMode='widthFix'
			>
		</u-swiper>
    </view>
</template>

<script>
	export default{
		data(){
			return{
				guideList:[
					'../../static/image/start/0-2引导页-1.png',
					'../../static/image/start/0-2引导页-2.png',
					'../../static/image/start/0-2引导页-3.png'
				],
				phoneHeight: 0,//屏幕高度
				data:null
			}
		},
		 onLoad(){
				 // 获取屏幕高度
					let self = this;
					uni.getSystemInfo({ 
					success(res) {
					// console.log(res.screenHeight); //屏幕高度  注意这里获得的高度宽度都是px 需要转换rpx
					// console.log(res.windowWidth); //可使用窗口宽度
					// console.log(res.windowHeight); //可使用窗口高度
					// console.log(res.screenWidth); //屏幕宽度
					// self.phoneHeight = (res.screenHeight * (750 / res.windowWidth))//窗口高度，将px 转换rpx
					self.phoneHeight =  res.screenHeight//窗口高度，将px 转换rpx
					// console.log(self.phoneHeight)
					}
				});
				this.data = uni.getStorageSync('userInfo');
			},
		methods:{
			change(e) {
				// console.log('change', e);
				// if(e.current === 2){
				// 	setTimeout(function() {
				// 		uni.switchTab({
				// 			url: '/pages/Home/Home',
				// 			animationType: 'pop-in',
				// 			animationDuration: 300
				// 		});
				// 	}, 2000)
				// }
			},
			click(e) {
				// console.log('click', e);
				if(e==2){
					if(this.data){
						console.log(this.data)
						uni.switchTab({
							url: '/pages/Home/Home',
							animationType: 'pop-in',
							animationDuration: 300
						});
					}else{
						uni.reLaunch({
							url: '/pages/Center/login',
							animationType: 'pop-in',
							animationDuration: 300
						});
					}
				}
			}
		}
	}
</script>

<style lang="scss" scoped>
	#guide{
		// width: 100vh;
	}
</style>